<template>
    <div>

    </div>
</template>
<script setup>
import { onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'

import { useList } from '../../store/index'
import { getQueryString,authLogin } from '../../utils/system/getCode'


const router = useRouter()
// const route = useRoute()
let store = useList()

//获取code
let code = getQueryString("code")


onMounted(() => {
    console.log(code,'code')
    if (!code) {
        console.log("未拿到code,code为:",code)
    } else {
        // let formData = new FormData();
        // formData.append("code", route.query.code);
        // if (route.query.orgId) {
        //   formData.append("orgId", route.query.orgId);
        // }
        // if (route.query.loginOrgId) {
        //     data.loginOrgId = route.query.loginOrgId
        //     data.searchOrgId = route.query.searchOrgId
        // }
        authLogin(code)
        router.push({path:'/center'})
            // store.updateToken(res.data)
            // getProfile()
        
    }
})

// const getProfile = async () =>{
//   var profile_ = await profile()
//   var orgList_ = await orgList()
//   // 当前登录者的orgId添加进组织切换
//   orgList_.data.unshift({id: profile_.data.orgId, aliasName: profile_.data.orgName })
//   store.updateUser(profile_.data)
//   store.updataauthType(profile_.data.authType)
//   store.updateOrgList(orgList_.data)
//   store.updateOrgId(orgList_.data[0].id)

//   if (route.query.source == 'zjg') {
//     router.push({path: '/largeScreenDataCenter/index'})
//     store.updateShowAdmin(false)
//   } else {
//     router.push({path: '/workHome/index', query: {mid: '1'}})
//   }
// }

</script>